﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WaterRevenueMS.Domain.Common.Models;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;


namespace WaterRevenueMS.Domain.ViewModels.BaseData.MeterReader
{
    public class MeterReaderModel : EntityCommon
    {
        public MeterReaderModel()
        {
            Search = new SearchModel();
            DefaultValue = 0;
            CompanyItems = new List<SelectListItem>() {
                new SelectListItem { Text = "--- 请选择 ---", Value = "0"}, 
            };
        }
        public int  id { get; set; }
        [Display(Name = "抄表员名称")]
        [Required(ErrorMessage = "抄表员名称")]
        [StringLength(16, MinimumLength = 2, ErrorMessage = "抄表员名称{2}～{1}个字符")]
        public string Chao_BYMC { get; set; }

        [Display(Name = "抄表员编码")]
        [Required(ErrorMessage = "抄表员编码")]
        [StringLength(50, MinimumLength = 2, ErrorMessage = "抄表员编码{2}~{1}个字节")]
        public string Chao_BYDM { get; set; }

        public string Dian_H { get; set; }
        [Display(Name = "排序序号")]
        [RegularExpression(@"\d+", ErrorMessage = "必须是数字")]
        public int OrderNo { get; set; }

        public byte DefaultValue { get; set; }

        [Display(Name = "所属单位")]
        public string CompanyName { get; set; }
        public List<SelectListItem> CompanyItems { get; set; }
        public int? CompanyId { get; set; }

        public SearchModel Search { get; set; }
    }
    public class SearchModel
    {
        public SearchModel()
        {

            CompanyItems = new List<SelectListItem>() {
                new SelectListItem { Text = "--- 请选择 ---", Value = "0"}, 
            };


        }

        public int id { get; set; }

        [Display(Name = "片区名称")]
        [Required(ErrorMessage = "片区名称")]
        [StringLength(16, MinimumLength = 2, ErrorMessage = "片区名称{2}～{1}个字符")]
        public string Qu_YMC { get; set; }

        [Display(Name = "抄表员名称")]
        [Required(ErrorMessage = "抄表员名称")]
        [StringLength(16, MinimumLength = 2, ErrorMessage = "抄表员名称{2}～{1}个字符")]
        public string Chao_BYMC { get; set; }

        [Display(Name = "抄表员编码")]
        [Required(ErrorMessage = "抄表员编码")]
        [StringLength(50, MinimumLength = 2, ErrorMessage = "抄表员编码{2}~{1}个字节")]
        public string Chao_BYDM { get; set; }

        public string Dian_H { get; set; }

        [Display(Name = "所属公司")]
        public string CompanyName { get; set; }
        public List<SelectListItem> CompanyItems { get; set; }
        public int? CompanyId { get; set; }




    }
}
